package edu.pku.sei.ocl.visitor;

import org.eclipse.emf.ecore.*;

public class GenVisitor
{
  protected static String nl;
  public static synchronized GenVisitor create(String lineSeparator)
  {
    nl = lineSeparator;
    GenVisitor result = new GenVisitor();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "";
  protected final String TEXT_2 = NL + "package edu.pku.sei.ocl.visitor;" + NL + "import edu.pku.sei.ocl.cst.*;" + NL + "" + NL + "public abstract class OCLVisitor {" + NL + "\t";
  protected final String TEXT_3 = NL + "\t\tpublic Object visit";
  protected final String TEXT_4 = "(";
  protected final String TEXT_5 = " expr,Context context){" + NL + "\t\t\tObject result = null;" + NL + "\t\t\t" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tpublic Object visit";
  protected final String TEXT_6 = "(";
  protected final String TEXT_7 = " expr,Context context,Object... expectedResult){" + NL + "\t\t\tObject result = null;" + NL + "\t\t\t" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t";
  protected final String TEXT_8 = NL + "}";

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
    
	EPackage pkg = (EPackage)argument;

    stringBuffer.append(TEXT_2);
    
		for(EClassifier ec : pkg.getEClassifiers()){
	
    stringBuffer.append(TEXT_3);
    stringBuffer.append(ec.getName());
    stringBuffer.append(TEXT_4);
    stringBuffer.append(ec.getName());
    stringBuffer.append(TEXT_5);
    stringBuffer.append(ec.getName());
    stringBuffer.append(TEXT_6);
    stringBuffer.append(ec.getName());
    stringBuffer.append(TEXT_7);
    
	}
	
    stringBuffer.append(TEXT_8);
    return stringBuffer.toString();
  }
}
